#include "avz.h"

using namespace AvZ;

void Script()
{
    SetZombies({
        ZOMBIE,
        POLE_VAULTING_ZOMBIE,
        FOOTBALL_ZOMBIE,
        DANCING_ZOMBIE,
        ZOMBONI,
        JACK_IN_THE_BOX_ZOMBIE,
        DIGGER_ZOMBIE,
        POGO_ZOMBIE,
        BUNGEE_ZOMBIE,
        LADDER_ZOMBIE,
        CATAPULT_ZOMBIE,
        GARGANTUAR,
        GIGA_GARGANTUAR,
        DOLPHIN_RIDER_ZOMBIE,
        SNORKEL_ZOMBIE,
    });

    SelectCards({
        ICE_SHROOM,
        M_ICE_SHROOM,
        COFFEE_BEAN,
        DOOM_SHROOM,
        CHERRY_BOMB,
        LILY_PAD,
        TALL_NUT,
        UMBRELLA_LEAF,
        PUFF_SHROOM,
        SUN_SHROOM,
    });

    SetTime(-599, 1);
    pao_operator.resetPaoList({
        {1, 5},
        {2, 5},
        {5, 5},
        {6, 5},
    });

    ice_filler.start({{3, 1}, {4, 1}, {1, 1}, {2, 1}, {5, 1}});
    SetTime(-200, 5);
    ice_filler.resetFillList({{3, 1}, {4, 1}});
    SetTime(-200, 19);
    ice_filler.pause();
    SetTime(2000, 19);
    ice_filler.resetFillList({{2, 1}, {5, 1}});

    SetTime(-599, 1);
    Card({{LILY_PAD, 3, 7}, {TALL_NUT, 3, 7}});
    Delay(751);
    Card(LILY_PAD, 3, 8);
    Delay(751);
    Card(LILY_PAD, 3, 1);
    Delay(751);
    Card(LILY_PAD, 4, 1);
    SetTime(-599 + 3001 + 3);
    Card({{LILY_PAD, 4, 7}, {TALL_NUT, 4, 7}});

    SetTime(18, 2);
    Shovel({{3, 1}, {4, 1}});

    for (auto wave : {1}) {
        // N 601
        SetTime(152, wave);
        Card({{DOOM_SHROOM, 3, 8}, {COFFEE_BEAN, 3, 8}});
        SetTime(0);
        Card(PUFF_SHROOM, 6, 9);
    }

    for (auto wave : {2, 6, 14, 18}) {
        // PP 601
        SetTime(325-373, wave);
        pao_operator.pao({{2, 9}, {5, 9}});
        SetTime(602 - 198 - 100);
        ice_filler.coffee();
    }

    for (auto wave : {7, 15}) {
        // I-PP 1724
        SetTime(1524 - 373, wave);
        pao_operator.pao({{2, 8.475}, {5, 8.475}});
        SetTime(1725 - 198 - 100);
        ice_filler.coffee();
    }

    SetTime(1415 - 373, 3);
        pao_operator.pao({{2, 8.475}, {5, 8.475}});
        SetTime(1616 - 198 - 100);
        ice_filler.coffee();

    for (auto wave : {11}) {
        // I-PP 1724
        SetTime(1524 - 373, wave);
        pao_operator.pao({{2, 8.475}, {5, 8.475}});
        SetTime(1725 - 198 - 100);
        ice_filler.coffee();
    }

    for (auto wave : {4, 8, 12, 16}) {
        // I-PP 1800
        SetTime(1600 - 373, wave);
        pao_operator.pao({{2, 8.45}, {5, 8.45}});
        SetTime(1801 - 198 - 100);
        ice_filler.coffee();
    }

    for (auto wave : {4}) {
        SetTime(400, wave);
        Card(CHERRY_BOMB, 2, 7);
    }

    for (auto wave : {5, 13, 17}) {
        // I-N 1150
        SetTime(950 - 100 - 198, wave);
        Card(LILY_PAD, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
        Card(DOOM_SHROOM, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
        Card(COFFEE_BEAN, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
    }

    for (auto wave : {9}) {
        SetTime(950 - 100 - 198, wave);
        Card(LILY_PAD, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
        Card(DOOM_SHROOM, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
        Card(COFFEE_BEAN, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});

        SetTime(1150+325-373);
        pao_operator.recoverPao({{2, 8.45}, {5, 8.45}, {2, 8}, {5, 8}});

        Delay(384);
        Card({{LILY_PAD, 3, 4}, {UMBRELLA_LEAF, 3, 4}});
    }

    for (auto wave : {10}) {
        SetTime(0, wave);
        Shovel(3, 7);
        Card(UMBRELLA_LEAF, 3, 7);
        Delay(600);
        Shovel({{3, 7}, {3, 4}, {3, 4}});
        Card(TALL_NUT, 3, 7);

        SetTime(-55);
        pao_operator.pao({{2, 9}, {5, 9}});
        SetTime(301);
        Card(CHERRY_BOMB, 2, 9);

        SetTime(602 - 198 - 100);
        ice_filler.coffee();
    }

    for (auto wave : {19}) {
        SetTime(1524 - 373, wave);
        pao_operator.pao({{2, 8.475}, {5, 8.475}});
        SetTime(1724 + 1549 - 373);
        pao_operator.recoverPao({{2, 8}, {5, 8}, {2, 8}, {5, 8}});

        SetTime(0);
        Delay(384);
        Card({{LILY_PAD, 3, 4}, {UMBRELLA_LEAF, 3, 4}});
    }

    for (auto wave : {20}) {
        SetTime(226 - 100 - 198, wave);
        Card(LILY_PAD, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
        Card(DOOM_SHROOM, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
        Card(COFFEE_BEAN, {{3, 8}, {3, 9}, {4, 8}, {4, 9}});
        SetTime(410 - 373);
        pao_operator.recoverPao({{2, 9}, {5, 9}});

        SetTime(0);
        Shovel(3, 7);
        Card(UMBRELLA_LEAF, 3, 7);
        SetTime(600);
        Shovel({{3, 7}, {3, 7}, {3, 8}, {3, 8}});
    }
}